{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>案件性质/分类/区域编号：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <div class="select-box" style="width:120px; ">
                    <select name="cn_id" class="select">
                        {$nature}
                    </select>
                </div>
                <div class="select-box" style="width:120px; ">
                    <select name="cate_id" class="select">
                        {$cate}
                    </select>
                </div>
                <div class="select-box" style="width:120px; ">
                    <select name="region" class="select">
                        {$region}
                    </select>
                </div>
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>报案人：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="报案人" name="from_user" value="{$vo.from_user ?? ''}" datatype="*" nullmsg="必填项目">
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>报案时间：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" id="from_time" class="input-text layui-input" placeholder="报案时间" name="from_time" value="{$vo.from_time ?? ''}" datatype="*" nullmsg="必填项目">
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>涉案人数：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="number" class="input-text" placeholder="涉案人数" name="people_num" value="{$vo.people_num ?? 1}" datatype="*" nullmsg="必填项目">
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>涉案金额：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" placeholder="涉案金额" name="money" value="{$vo.money ?? '0.00'}" datatype="*" nullmsg="必填项目">
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>图片：</label>
            <div class="formControls col-xs-8 col-sm-8">
                {volist name ="imgs" id ="img"}
                <span class="img-box" onclick="layer_open('文件上传','/community/upload/index/id/upload/fun/addImg/id/{$i}')"><input type="hidden" name="imgs[]" value="{$img}"><img src="{$img}" width="100"/><i class="Hui-iconfont" onclick="delImg(this)">&#xe6e2;</i></span>
                {/volist}
                <span class="btn-add-img img-box" onclick="layer_open('文件上传','/community/upload/index/id/upload/fun/addImg/id/add')"><img src="__ROOT__/static/admin/images/btn-add-img.jpg" width="100"/></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-2 col-sm-2">备注：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <textarea type="text" class="input-text" style="height:60px;" placeholder="备注" name="remark">{$vo.remark ?? ''}</textarea>
            </div>
            <div class="col-xs-2 col-sm-2"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__ROOT__/static/laydate/laydate.js"></script>
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<style>
    .img-box{ display: inline-block; margin-right: 5px; position: relative; width: 100px; height: 90px; overflow: hidden;}
    .img-box i{ position: absolute; top:0px; right:0px; z-index: 10; cursor: pointer; background-color:rgba(255,255,255,.7);}
</style>
<script>
    $(function () {
        $("[name='cn_id'] option[value='{$vo.cn_id ?? 0}']").prop("selected", true);
        $("[name='cate'] option[value='{$vo.cate ?? 0}']").prop("selected", true);

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });
        laydate.render({
            elem: '#from_time'
            ,type: 'datetime'
        });
    });
    //添加图片
    function addImg(url,index){
        var len = $('input[name="imgs[]"]').length;
        if( 'add' == index ) {
            $('.btn-add-img').before('<span class="img-box" onclick="layer_open(\'文件上传\',\'/community/upload/index/id/upload/fun/addImg/id/'+len+'\')"><input type="hidden" name="imgs[]" value="'+url+'"><img src="'+url+'" width="100"/><i class="Hui-iconfont" onclick="delImg(this)">&#xe6e2;</i></span>');
        } else {
            $('input[name="imgs[]"]').eq(index).val(url);
            $('input[name="imgs[]"]').eq(index).siblings('img').attr('src',url);
        }
    }
    function delImg(that) {
        event.stopPropagation();
        $(that).parent('.img-box').remove();
        return false;
    }
</script>
{/block}
